<?php
// +----------------------------------------------------------------------
// | NewThink [ Think More,Think Better! ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2018 http://www.newthink.cc All rights reserved.
// +----------------------------------------------------------------------
// | 版权所有：山西创泰网络科技有限公司
// +----------------------------------------------------------------------
// | Author: 燕南天 QQ:81020302 Date:2018-08-01 Time:17:43
// +----------------------------------------------------------------------

namespace app\api\service;

class TokenInfoCenter extends InfoBase
{
    public function _initialize()
    {
        $this->infoString = OptionsCenter::$infoToken;
    }
    
    protected function parseToken($token){
        if (empty($token)){
            return false;
        }
        $tokenInfo = TokenInfoCenter::instance($token)->getInfoList([
//            OptionsCenter::$idCharge,
//            OptionsCenter::$idPark,
//            OptionsCenter::$idTerminal
        ]);
        if (empty($tokenInfo) || !isset($tokenInfo[OptionsCenter::$idCharge])  || !isset($tokenInfo[OptionsCenter::$idTerminal])      ){
            return false;
        }
        $this->tokenInfo = $tokenInfo;
        $this->isLogin = true;
        $this->chargeId =$tokenInfo[OptionsCenter::$idCharge];
        $this->terminalId =$tokenInfo[OptionsCenter::$idTerminal];
    }
}